lib.use(['element', 'table', 'form'], function () {
    var layer = layui.layer;
    var form = layui.form;
    var $ = layui.jquery;
    var updateForm = layui.Form('updateForm');

    form.verify({
        beanName: function(value, item){ //value：表单的值、item：表单的DOM对象
            if(!value){
                return 'Bean名称不能为空';
            }
        },
        cronExpression: function(value, item){ //value：表单的值、item：表单的DOM对象
            if(!value){
                return 'cron表达式不能为空';
            }
        }
    });
    form.on('submit(updateFormSubmitFilter)', function (data) {
        var param = updateForm.getData();
        console.log('schedule Update param is', param);
        ApiUtil.post('/sys/schedule/update', param, function (resp) {
            layer.alert('修改成功', function () {
                location.href = 'jobList.html';
            })
        })
        return false;
    });

    function loadFormData() {
        var id = ApiUtil.getParam('id');
        if (!id) {
            layer.alert('id错误');
            return;
        }
        ApiUtil.get('/sys/schedule/info/'+id, {}, function (resp) {
            console.log('Job Info Data is', resp.menu);
            updateForm.setData(resp.schedule);
        });
    }
    loadFormData();
});
